package com.smart.manager.union.mall.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.smart.common.entities.ajax.AjaxResult;
import com.smart.common.entities.constant.SmartConstant;
import com.smart.common.entities.core.Page;

import com.smart.manager.union.mall.body.RUnionMallOrder;
import com.smart.manager.union.mall.models.UnionMallOrder;
import com.smart.manager.union.mall.repository.UnionMallOrderRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 狼山鸡蛋兑换规格
 *
 * @author Administrator
 */
@Api(tags = "狼山鸡蛋订单")
@RestController
@RequestMapping(SmartConstant.MANAGER_API_PREFIX + "union/mall/order")
@RequiredArgsConstructor


public class UnionMallOrderApi {

    private final UnionMallOrderRepository repository;

    @GetMapping(value = "pageList")
    @ApiOperation(value = "查询订单")
    @SaCheckPermission("union:mall:order:pageList")
    public AjaxResult<Page<UnionMallOrder>> pageList(@Validated RUnionMallOrder.SearchBody body) {
        Page<UnionMallOrder> result = repository.pageList(body);
        return AjaxResult.data(result);
    }


    @PostMapping(value = "replenishExpress")
    @ApiOperation(value = "订单发货")
    @SaCheckPermission("union:mall:order:replenishExpress")
    public AjaxResult<String> replenishExpress(@Validated @RequestBody RUnionMallOrder.ReplenishExpress body) {
        repository.replenishExpress(body);
        return AjaxResult.success();
    }


}
